package com.dpp.mapper;

import com.dpp.entity.Invite;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface InviteMapper {
    @Select("select * from invite where openid=#{openid} ")
    Invite selectByOpenid(String openid);
    @Insert("insert into invite ( openid, pass, count, create_time) VALUES (#{openid} ,#{pass} ,#{count} ,#{createTime} )")
    void save(Invite invite);
    @Select("select * from invite where pass=#{pass} ")
    Invite selectByCode(String pass);
    @Update("UPDATE invite SET count=count-1 WHERE openid=#{openid} ")
    void updataReduceCount(String openid);
}
